[BLKTAP] Ensure blktap doesn't try to re-create extant sysfs entries
authorJake Wires <jwires@xensource.com>
Sat, 19 May 2007 17:54:01 +0000 (10:54 -0700)
committerJake Wires <jwires@xensource.com>
Sat, 19 May 2007 17:54:01 +0000 (10:54 -0700)
Signed-off-by: Jake Wires <jwires@xensource.com>
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c

index 5fa4c31a9bc7cf0b6f27410934b6d19c9e2940d5..1d99f1434f9311df8683b1b34c30da4deb9b5455 100644 (file)
@@ -161,7 +161,9 @@ int xentap_sysfs_addif(struct xenbus_device *dev)
 
 void xentap_sysfs_delif(struct xenbus_device *dev)
 {
+       struct backend_info *be = dev->dev.driver_data;
        sysfs_remove_group(&dev->dev.kobj, &tapstat_group);
+       be->group_added = 0;
 }
 
 static int blktap_remove(struct xenbus_device *dev)
@@ -212,11 +214,13 @@ static void tap_update_blkif_status(blkif_t *blkif)
                return;
        }
 
-       err = xentap_sysfs_addif(blkif->be->dev);
-       if (err) {
-               xenbus_dev_fatal(blkif->be->dev, err, 
-                                "creating sysfs entries");
-               return;
+       if (!blkif->be->group_added) {
+               err = xentap_sysfs_addif(blkif->be->dev);
+               if (err) {
+                       xenbus_dev_fatal(blkif->be->dev, err, 
+                                        "creating sysfs entries");
+                       return;
+               }
        }
 
        blkif->xenblkd = kthread_run(tap_blkif_schedule, blkif, name);